package com.jason.java.demo.annotation;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.cby.code.util.ToastUtils;
import com.jason.java.demo.R;

/**
 * @description: AnnotationActivity
 * @author: ChenBaoYang
 * @createDate: 2022/3/10 10:30 上午
 */
public class AnnotationActivity extends AppCompatActivity {

    @InjectView(R.id.bind_view_btn)
    Button bindViewBtn;

    @InjectView(R.id.bind_click_btn)
    Button bindClickBtn;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_annotation);
        InjectUtils.inject(this);
        if(bindClickBtn != null && bindViewBtn != null) {
            ToastUtils.showToast(this, "注入成功");
        }
    }

    @OnClick({R.id.bind_view_btn, R.id.bind_click_btn})
    public void injectOnClick(View view) {
        if(view.getId() == R.id.bind_view_btn) {
            ToastUtils.showToast(this, "bindViewBtn 被点击了");
        }else if(view.getId() == R.id.bind_click_btn) {
            ToastUtils.showToast(this, "bindClickBtn 被点击了");
        }
    }
}
